<?php
require_once('UserOrder.php');
$med =$_POST['medicine'];
$power = $_POST['power'];
$comp = $_POST['company'];
$quant = $_POST['quantity'];
$type = $_POST['type'];
$objorderLoc = new OrderLocation();
//$objorderLoc ->Test();
//Get the address detail here.			   
$objorderLoc->EmailAddress=$_POST['EmailAddress'];
$objorderLoc->MobileNumber=$_POST['MobileNumber'];
$objorderLoc->Address=$_POST['Address'];
$objUserOrder = new UserOrder();
$objUserOrder->OrderLocation = $objorderLoc;
//Get the order detail
$objUserOrder->OrderDetail = array();
foreach( $med as $key => $n ) {
$objOrder = new OrderDetail();
$objOrder->MedicineName = $n;
$objOrder->Power=$power[$key];
$objOrder->Quantity=$quant[$key];
$objOrder->Company=$comp[$key];
$objOrder->Type=$type[$key];
array_push($objUserOrder->OrderDetail,$objOrder);
}
$URL="index.php?os";
if($objUserOrder->AddOrder())
{
$URL="../index.php?os";
} else
{
$URL="../index.php?of";
}
echo '<META HTTP-EQUIV="refresh" content="0;URL=' . $URL . '">';
?>